<%@ page language="java"
	import="java.util.*,edu.cnu.tpts.bean.*,edu.cnu.tpts.dao.*,edu.cnu.tpts.dao.impl.*"
	pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/authorize.jsp"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">



<html>
<head>
	<base href="<%=basePath%>">
    <title>admin</title>
    <link rel="stylesheet" type="text/css" href="/css/main.css">
</head>
<body>
<div id="header">

</div>

<div id="menu">
    <ul>

        
        <li><a hidefocus="hidefocus" href="teacher/showTeacher.jsp">查询个人信息</a></li>         
         <li><a hidefocus="hidefocus" href="teacher/updateTeacher.jsp">更新个人信息</a></li>
        <li><a hidefocus="hidefocus" href="teacher/showStudentScore.jsp">学生成绩维护</a></li>
          <li><a hidefocus="hidefocus" href="teacher/predict.jsp">成绩和能力预测</a></li>
        <li><a hidefocus="hidefocus" href="teacher/alarm.jsp">查看预警信息</a></li>
         <li><a hidefocus="hidefocus" href="quit.jsp">退出</a></li>
         	 <%@include file="/WEB-INF/date.jsp"%>
     </ul>
 
</div>

<div class="table">
     <%
      String type=(String)session.getAttribute("type");
   TeacherDao teacherDao=new TeacherDaoImpl();    
    Teacher  teacher=null;
    if(type.equals("teacher")){     //学生更新自己的信息
     	
    	Teacher ttea=(Teacher)session.getAttribute("user");
    	teacher=teacherDao.findById(ttea.getId());
    }else{ //管理员更新学生信息
       int teaid=Integer.parseInt(request.getParameter("teaid"));
    	teacher=teacherDao.findById(teaid);
    }
   
   
   
   // Teacher teacher=(Teacher)session.getAttribute("user");
    //teacher=teacherDao.findById(teacher.getId());
    //teacher=teacherDao.findById(1);
    
     %>
     <form action="teacher/doupdateTeacher.jsp" method="post"  >      
     <table>
     	<tr>
     		<td>教师编号</td>
     		<td><input type="text" name="id" value="<%=teacher.getId() %>" readonly></td>
     	</tr>
     	<tr>
     		<td>登录名</td>
     		<td><input type="text" name="loginname" value="<%=teacher.getLoginName() %>" ></td>
     	</tr>
     	<tr>
     		<td>教师姓名</td>
     		<td><input type="text" name="realname" value="<%=teacher.getRealName() %>"   readonly></td>
     	</tr>
     	<tr>
     		<td>密码</td>
     		<td><input type="password" name="password"  ></td>
     	</tr>
     	<tr>
     		<td>确认密码</td>
     		<td><input type="password" name="repassword" >
     		<span><%
     		String error=(String)request.getAttribute("error");
     		if(error!=null)  out.print(error);
     		 %>
     		
     		 </span></td>
     	</tr>
     	
     	<tr>
     		<td>性别</td>
     		<td><input type="text" name="sex" value="<%=teacher.getSex() %>" readonly></td>
     	</tr>
     	<tr>
     		<td>所在院系</td>
     		<td><input type="text" name="stu_department" value="<%=teacher.getTeaDepartment() %>" readonly></td>
     	</tr>
     	<tr>
     		<td colspan="2"><input type="submit" value="提交"/></td>
     	
     	</tr>  
     </table>
     </form>
</div>

<div id="copyright">
    <div align="center">
        <font face="Tahoma, Verdana" color="#ffffff">Copyright &copy; 首都师范大学版权所有<br>

            地址：北京市西三环北路105号 100048&nbsp;&nbsp;&nbsp;&nbsp; E-mail: </font><font face="Tahoma, Verdana">

    </font>
    </div>

</div>

</body>
</html>